﻿using System;
using System.Collections.Generic;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt
{
	// Token: 0x02000083 RID: 131
	public class TAlterTableStatement : TCustomSqlStatement
	{
		// Token: 0x06000334 RID: 820 RVA: 0x002F9922 File Offset: 0x002F7B22
		public TAlterTableStatement(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstaltertable;
		}

		// Token: 0x06000335 RID: 821 RVA: 0x002F9933 File Offset: 0x002F7B33
		internal override void buildsql()
		{
		}

		// Token: 0x06000336 RID: 822 RVA: 0x002F9935 File Offset: 0x002F7B35
		internal override void clear()
		{
		}

		// Token: 0x06000337 RID: 823 RVA: 0x002F9937 File Offset: 0x002F7B37
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000338 RID: 824 RVA: 0x002F993E File Offset: 0x002F7B3E
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x1700004E RID: 78
		// (get) Token: 0x06000339 RID: 825 RVA: 0x002F9940 File Offset: 0x002F7B40
		// (set) Token: 0x0600033A RID: 826 RVA: 0x002F9948 File Offset: 0x002F7B48
		public virtual TAlterTableOptionList AlterTableOptionList
		{
			get
			{
				return this.alterTableOptionList;
			}
			set
			{
				this.alterTableOptionList = value;
			}
		}

		// Token: 0x1700004F RID: 79
		// (get) Token: 0x0600033B RID: 827 RVA: 0x002F9951 File Offset: 0x002F7B51
		// (set) Token: 0x0600033C RID: 828 RVA: 0x002F9959 File Offset: 0x002F7B59
		public virtual List<TMySQLCreateTableOption> MySQLTableOptionList
		{
			get
			{
				return this.mySQLTableOptionList;
			}
			set
			{
				this.mySQLTableOptionList = value;
			}
		}

		// Token: 0x17000050 RID: 80
		// (get) Token: 0x0600033D RID: 829 RVA: 0x002F9962 File Offset: 0x002F7B62
		// (set) Token: 0x0600033E RID: 830 RVA: 0x002F996A File Offset: 0x002F7B6A
		public virtual TTableElementList TableElementList
		{
			get
			{
				return this.tableElementList;
			}
			set
			{
				this.tableElementList = value;
			}
		}

		// Token: 0x0600033F RID: 831 RVA: 0x002F9974 File Offset: 0x002F7B74
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TAlterTableSqlNode talterTableSqlNode = (TAlterTableSqlNode)this.rootNode;
			base.doParseStatement(psql);
			this.tableName = talterTableSqlNode.TableName;
			this.TargetTable = this.analyzeTablename(this.tableName);
			this.TargetTable.EffectType = ETableEffectType.tetAlter;
			this.mySQLTableOptionList = talterTableSqlNode.MySQLTableOptionList;
			this.alterTableOptionList = talterTableSqlNode.AlterTableOptionList;
			if (this.alterTableOptionList != null)
			{
				this.alterTableOptionList.doParse(this, ESqlClause.unknown);
			}
			return 0;
		}

		// Token: 0x17000051 RID: 81
		// (get) Token: 0x06000340 RID: 832 RVA: 0x002F99F7 File Offset: 0x002F7BF7
		// (set) Token: 0x06000341 RID: 833 RVA: 0x002F99FF File Offset: 0x002F7BFF
		public virtual TObjectName TableName
		{
			get
			{
				return this.tableName;
			}
			set
			{
				this.tableName = value;
			}
		}

		// Token: 0x06000342 RID: 834 RVA: 0x002F9A08 File Offset: 0x002F7C08
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000343 RID: 835 RVA: 0x002F9A18 File Offset: 0x002F7C18
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.alterTableOptionList != null)
			{
				for (int i = 0; i < this.alterTableOptionList.size(); i++)
				{
					this.alterTableOptionList.getAlterTableOption(i).acceptChildren(v);
				}
			}
			if (this.mySQLTableOptionList != null)
			{
				foreach (TMySQLCreateTableOption tmySQLCreateTableOption in this.mySQLTableOptionList)
				{
					tmySQLCreateTableOption.acceptChildren(v);
				}
			}
			v.postVisit(this);
		}

		// Token: 0x0400109E RID: 4254
		private TAlterTableOptionList alterTableOptionList;

		// Token: 0x0400109F RID: 4255
		private TTableElementList tableElementList;

		// Token: 0x040010A0 RID: 4256
		private List<TMySQLCreateTableOption> mySQLTableOptionList;

		// Token: 0x040010A1 RID: 4257
		private TObjectName tableName;
	}
}
